package com.serviceprovider.business.module.sp.transaction.model;

//~--- non-JDK imports --------------------------------------------------------

import com.serviceprovider.business.module.report.valueobjects.TransStatusVO;

/**
 * Created by IntelliJ IDEA.
 * User: akilesa
 * Date: 10-May-2010
 * Time: 1:06:19 PM
 * To change this template use File | Settings | File Templates.
 */
public class TransactionStatus {
    private boolean isActive = false;
    private Integer id;
    private String  meaning;
    private String  name;

    public TransactionStatus() {}

    public TransactionStatus(TransStatusVO status) {
        this.name     = status.getName();
        this.meaning  = status.getMeaning();
        this.isActive = status.isActive();
        this.id       = status.getId();
    }

    public TransactionStatus(Integer id, String name, String meaning, boolean active) {
        this.id      = id;
        this.name    = name;
        this.meaning = meaning;
        isActive     = active;
    }

    @Override
    public boolean equals(Object obj) {
        if ((obj == null) ||!(obj instanceof TransactionStatus)) {
            return false;
        }

        TransactionStatus b  = (TransactionStatus) obj;
        boolean           eq = ((id == null) && (b.id == null)) || ((id != null) && id.equals(b.id));

        if (!eq) {
            return false;
        }

        eq = ((name == null) && (b.name == null)) || ((name != null) && name.equals(b.name));

        if (!eq) {
            return false;
        }

        eq = ((meaning == null) && (b.meaning == null)) || ((meaning != null) && meaning.equals(b.meaning));

        if (!eq) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int prime  = 31;
        int result = 1;

        result = prime * result + ((id == null)
                                   ? 0
                                   : id.hashCode());
        result = prime * result + ((name == null)
                                   ? 0
                                   : name.hashCode());
        result = prime * result + ((meaning == null)
                                   ? 0
                                   : meaning.hashCode());

        return result;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMeaning() {
        return meaning;
    }

    public void setMeaning(String meaning) {
        this.meaning = meaning;
    }

    public boolean isActive() {
        return isActive;
    }

    public void setActive(boolean active) {
        isActive = active;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
}



